# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=pipal
pkgver=3.4.0.r9.g392f0aa
pkgrel=4
groups=('blackarch' 'blackarch-cracker')
pkgdesc='A password analyser.'
url='https://github.com/digininja/pipal'
arch=('any')
license=('GPL3')
depends=('git' 'ruby')
source=("git+https://github.com/digininja/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
exec ruby /usr/share/$pkgname/$pkgname.rb "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}
